<!DOCTYPE html>
<html>
<head>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1" name="viewport" />
    <title><%=title%></title>
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
</head>
<body ng-app="logApp">

<nav class="navbar navbar-inverse" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <a class="navbar-brand" href="javascript:void(0)" style="color: white;"><%=title%></a>
        </div>
    </div><!-- /.container-fluid -->
</nav>

<div ng-controller="login">
    <div class="row">
        <form class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4" role="form">
            <div class="form-group">
                <label>登录名</label>
                <input type="text" ng-model="_l.username" class="form-control" placeholder="">
            </div>
            <div class="form-group">
                <label>密&nbsp;&nbsp;&nbsp;码</label>
                <input type="password" ng-model="_l.password" class="form-control" placeholder="">
            </div>
            <button type="submit" ng-click="login()" class="btn btn-success btn-block">登录</button>
        </form>
    </div>
</div>

<script src="javascripts/jquery/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="angular/angular.min.js"></script>
<script>
    var appIndex = angular.module('logApp',[]);
    appIndex.controller('login', function ($scope, $http) {
        $scope.login = function () {
            $http.post('/users/login',{
                username: $scope._l.username,
                password: $scope._l.password
            }).success(function (msg) {
                if(msg.error) alert(msg.result);
                else location.assign('/');
            })
        }
    })
</script>